<script type="text/javascript" src="${baseUrl}/js/jquery-1.8.2.min.js"></script>
<script src="${baseUrl}/resources/js/jquery.ext.js"></script>
<script src="${baseUrl}/resources/js/layer/extend/layer.ext.js"></script>
<script src="${baseUrl}/resources/js/layer/layer.js"></script>
<script type="text/javascript">
function optDel(id){
	$.confirm("确认删除？", function(){
		$.post("${baseUrl}/address/remove",{id:id},function(data){
				$.alert(data.msg.msgText,data.msg.msgStatus);
				refreshdata();
				window.parent.refreshData();
		});
	});
}
$().ready(function(){
	refreshdata();
});
function refreshdata(){
	$("#addressTable").empty();
	$.get("${baseUrl}/address/list",{},function(data){
		var html="<thead><th>收货地址</th><th>操作</th></thead>";
		$.each(data.addresses,function(i,address){
				html+='<tr><td><span>'+address.address+'('+address.acceptusername+'&nbsp;'+address.tel+')</span></td><td>&nbsp;&nbsp;&nbsp;<a href="#none" onclick="optDel(\''+address.id+'\')">删除</a>&nbsp;<a href="">修改</a></td></tr>';
		});
		$("#addressTable").append(html);
	});
}
</script>
</head>
<body>
	<table id="addressTable">
	</table>
</body>
</html>